/**
 * 移动端工具函数
 */
import { MessageBox } from 'element-ui'

/**
 * 移动端优化的确认对话框
 * @param {string} message 提示信息
 * @param {string} title 标题
 * @param {object} options 配置选项
 * @returns {Promise} Promise对象
 */
export function mobileConfirm(message, title = '提示', options = {}) {
  const defaultOptions = {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning',
    customClass: 'mobile-message-box',
    closeOnClickModal: false,
    closeOnPressEscape: true,
    showClose: true,
    center: true,
    roundButton: true
  }

  // 合并配置选项
  const mergedOptions = Object.assign({}, defaultOptions, options)

  return MessageBox.confirm(message, title, mergedOptions)
}

/**
 * 移动端优化的警告对话框
 * @param {string} message 提示信息
 * @param {string} title 标题
 * @param {object} options 配置选项
 * @returns {Promise} Promise对象
 */
export function mobileAlert(message, title = '提示', options = {}) {
  const defaultOptions = {
    confirmButtonText: '确定',
    type: 'warning',
    customClass: 'mobile-message-box',
    closeOnClickModal: false,
    closeOnPressEscape: true,
    showClose: true,
    center: true,
    roundButton: true
  }

  // 合并配置选项
  const mergedOptions = Object.assign({}, defaultOptions, options)

  return MessageBox.alert(message, title, mergedOptions)
} 